package com.doradance.recycle;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;


import com.doradance.R;
import com.doradance.base.BaseActivity;
import com.doradance.recycle.adapter.MainAdapter;

import java.util.ArrayList;

import butterknife.Bind;

public class RecycleHomeActivity extends BaseActivity {
    ArrayList<String> mList;

    @Bind(R.id.main_recy)
    RecyclerView mMainRecy;

    @Override
    protected void initToolbar() {
        //设置标题栏的属性
        mToolbar.setTitle("好的");
        //隐藏标题栏
//        mToolbar.setVisibility(View.GONE);
    }

    //页面跳转
    public static void start(Activity activity) {
        Intent intent = new Intent(activity, RecycleHomeActivity.class);
        activity.startActivity(intent);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initdata();
        initAdapter();
    }

    //初始化Adapter
    private void initAdapter() {
        //设置布局管理器
        mMainRecy.setLayoutManager(new LinearLayoutManager(this));
        //如果可以确定每个item的高度是固定的，设置这个选项可以提高性能
        mMainRecy.setHasFixedSize(true);
        //初始化和设置Adapter
        MainAdapter mainAdapter = new MainAdapter(mList);
        mMainRecy.setAdapter(mainAdapter);

}
    private void initdata() {
        mList = new ArrayList<>();
        for(int i=0;i<4;i++){
            mList.add("纵向和横向滑动");
            mList.add("纵向和横向瀑布流");
            mList.add("添加头布局和脚布局");
            mList.add("下拉刷新和上拉加载");
            mList.add("多布局页面");
            mList.add("滑动删除");
            mList.add("点击事件");
            mList.add("添加空布局");
            mList.add("添加分割线");
        }
    }

    @Override
    protected int getContentViewLayoutId() {
        return R.layout.activity_recycle_home;
    }

    @Override
    protected void onViewCreated(Bundle savedInstanceState) {

    }
}
